package libra;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.log.LogFormatUtils;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.HttpServerErrorException;
import org.springframework.web.client.ResponseErrorHandler;
import org.springframework.web.client.RestClientResponseException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.client.UnknownHttpStatusCodeException;

import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
import com.alibaba.cloud.sentinel.rest.SentinelClientHttpResponse;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.alibaba.fastjson.JSON;

import libra.sentinelRestTemplate.call.BlockExHandler_RestTemplate;

//标注该类为SpringBoot的主配置类
@SpringBootApplication
//SpringBoot默认已开启事务，不需要自己手动开启
//@EnableTransactionManagement
//指定包扫描
@ComponentScan(value= {"libra"})
//扫描Servlet组件，java -jar形式运行必须开启 
@ServletComponentScan(value="libra")
public class MainEntry {
	public static void main(String[] args) {
		/*
		 * 启动Spring应用，返回一个ConfigurableApplicationContext的context对象，可以像原来一样从里面通过getbean等方法，获取对象
		 * run()传入的类，一定要是个用@SpringBootApplication注解标注的类，被@SpringBootApplication标注的类被解释为SpringBoot的主配置类。
		 * 当程序执行时，就应该运行该类的main方法来启动SpringBoot应用。
		 */
		ConfigurableApplicationContext cac = org.springframework.boot.SpringApplication.run(MainEntry.class, args);
	}
}


